/**
 * ControladoraNivel.java
 */

 /**
 *  AdSec: Administrador de Secundarias
 *  Copyright (C) 2009 Daniela Ramírez Chaves (dannyrch@gmail.com)
 *  Copyright (C) 2009 Leonel Salazar Valverde (leo87sv@gmail.com)
 *
 *  This file is part of AdSec.
 *  AdSec is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  AdSec is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with AdSec.  If not, see <http://www.gnu.org/licenses/>.
 */

package adsec.negocios;
import adsec.datos.ControladoraBDNivel;
import java.util.LinkedList;
import adsec.entidades.Anio;
import adsec.entidades.Materia;
import adsec.entidades.Nivel;


public class ControladoraNivel {

    private ControladoraBDNivel controladoraBD;

    public ControladoraNivel(){
        this.controladoraBD = new ControladoraBDNivel();
    }//fin de constructor

    public Nivel consultarNivel(Anio anio, Nivel nivelConsultado){
        Nivel nivel = this.controladoraBD.consultarNivel(anio, nivelConsultado);
        return nivel;
    }

    public LinkedList<Nivel> consultarNiveles(Anio anio){
        LinkedList<Nivel> niveles = this.controladoraBD.consultarNiveles(anio);
        return niveles;
    }

    public LinkedList<Nivel> consultarNivelesTodos(){
        LinkedList<Nivel> niveles = this.controladoraBD.consultarNivelesTodos();
        return niveles;
    }

    public int insertarNivel(Nivel nivel){
        return this.controladoraBD.insertarNivel(nivel);
    }

    public int modificarNivel(Nivel nivel){
        return this.controladoraBD.modificarNivel(nivel);
    }

    public int eliminarNivel(Nivel nivel){
        return this.controladoraBD.eliminarNivel(nivel);
    }

    public boolean nivelTieneSecciones(Nivel nivel){
        return this.controladoraBD.nivelTieneSecciones(nivel) > 0;
    }

    public boolean nivelTieneMaterias(Nivel nivel){
        ControladoraMateria controladoraMateria = new ControladoraMateria();
        LinkedList<Materia> materias = controladoraMateria.consultarMateriasNivel(nivel.getNivel());
        return materias.size() > 0;
    }
    
}//fin de clase ControladoraNiveles
